import React from 'react'
import { Modal, Form, Input } from 'antd';
import { AddGroup } from '@/apis/user';


type Props = {
    visiable: boolean,
    close: (state: boolean) => void
}

const AddUserGroup = ({ visiable, close }: Props) => {

    const [form] = Form.useForm()

    const handleOk = async () => {
        const value = form.getFieldsValue()
        console.log(value);
        const res = await AddGroup(value)
        close(false)
    }
    const handleCancel = () => { close(false) }

    return (
        <Modal title="添加分组" open={visiable} destroyOnClose={true} onOk={handleOk} onCancel={handleCancel} width={700}>
            <Form preserve={false} form={form} labelCol={{ span: 4 }}>
                <Form.Item label='分组名称' name='name' rules={[{ required: true }]}>
                    <Input />
                </Form.Item>
            </Form>
        </Modal>
    )
}

export default AddUserGroup